package C7_2_MoveField;

/**
 * 搬移字段-自我封装
 */
public class Account2 {

    private AccountType _type;

    private double _interestRate;

    /**
     * 重构前
     */
    double interestForAmount_days(double amount, int days) {
        return getInterestRate() * amount * days / 365;
    }

    /**
     * 重构后
     */
    double interestForAmount_days2(double amount, int days) {
        return getInterestRate2() * amount * days / 365;
    }


    public double getInterestRate() {
        return _interestRate;
    }

    public void setInterestRate(double arg) {
        this._interestRate = arg;
    }


    public double getInterestRate2() {
        return _type.getInterestRate();
    }

    public void setInterestRate2(double arg) {
        _type.setInterestRate(arg);
    }

}
